package cn.bone.motan.web;

import cn.bone.api.FooService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.lang.reflect.Type;

/**
 * Created by MD-01 on 2017/3/8.
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

    private Logger logger = LoggerFactory.getLogger(DemoController.class);

    @Resource
    private FooService fooService;

    @RequestMapping("/hello")
    public String hello(String name){

        logger.info(fooService.getClass().getName());
        Type[] genericInterfaces = fooService.getClass().getGenericInterfaces();
        for(Type type : genericInterfaces){
            logger.info(type.getClass().getName()+"-->"+type.getTypeName());
        }
        logger.info(fooService.getClass().getSuperclass().getName());
        logger.info(fooService.getClass().getGenericSuperclass().getTypeName());
        String result = fooService.hello(name);
        BeanWrapperImpl bean;
        return result;
    }
}
